package vip.finance.makemoney.apiSpider.snowball;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import vip.finance.makemoney.apiSpider.AbstractSpider;
import vip.finance.makemoney.apiSpider.result.StockDetailInfo;

import java.util.List;

/**
 * 雪球
 *
 * @author 杨滨
 * @date 2023年02月03日
 */
@Slf4j
@Component
public class SnowApiSpiderImpl extends AbstractSpider {
    @Resource
    private SnowStockApi snowStockApi;

    /**
     * 实时行情
     *
     * @param codes
     * @return
     */
    @Override
    public List<StockDetailInfo> realTime(List<String> codes) {
        return null;
//        SnowRealTimeResult snowRealTimeResult = snowApi.realTime(String.join(",", codes),"detail");
//        return snowRealTimeResult.getData().getItems().stream().map(x -> {
//                    StockDetailInfo stockDetailInfo = new StockDetailInfo();
//                    StockDetailInfo.MarketBean marketBean = new StockDetailInfo.MarketBean();
//                    StockDetailInfo.QuoteBean quoteBean = new StockDetailInfo.QuoteBean();
//                    stockDetailInfo.setMarket(marketBean);
//                    stockDetailInfo.setQuote(quoteBean);
//                    marketBean.setRegion(x.getMarket().getRegion());
//                    marketBean.setStatus(x.getMarket().getStatus());
//                    quoteBean.setSymbol(x.getQuote().getSymbol());
//                    quoteBean.setCode(x.getQuote().getCode());
//                    quoteBean.setExchange(x.getQuote().getExchange());
//                    quoteBean.setName(x.getQuote().getName());
//                    quoteBean.setType(x.getQuote().getType());
//                    quoteBean.setCurrent(x.getQuote().getCurrent());
//                    quoteBean.setCurrency(x.getQuote().getCurrency());
//                    quoteBean.setPercent(x.getQuote().getPercent());
//                    quoteBean.setChg(x.getQuote().getChg());
//                    quoteBean.setTimestamp(x.getQuote().getTimestamp());
//                    quoteBean.setTime(x.getQuote().getTime());
//                    quoteBean.setLot_size(x.getQuote().getLot_size());
//                    quoteBean.setTick_size(x.getQuote().getTick_size());
//                    quoteBean.setOpen(x.getQuote().getOpen());
//                    quoteBean.setLast_close(x.getQuote().getLast_close());
//                    quoteBean.setHigh(x.getQuote().getHigh());
//                    quoteBean.setLow(x.getQuote().getLow());
//                    quoteBean.setAvg_price(x.getQuote().getAvg_price());
//                    quoteBean.setVolume(x.getQuote().getVolume());
//                    quoteBean.setAmount(x.getQuote().getAmount());
//                    quoteBean.setTurnover_rate(x.getQuote().getTurnover_rate());
//                    quoteBean.setAmplitude(x.getQuote().getAmplitude());
//                    quoteBean.setMarket_capital(x.getQuote().getMarket_capital());
//                    quoteBean.setFloat_market_capital(x.getQuote().getFloat_market_capital());
//                    quoteBean.setTotal_shares(x.getQuote().getTotal_shares());
//                    quoteBean.setFloat_shares(x.getQuote().getFloat_shares());
//                    quoteBean.setIssue_date(x.getQuote().getIssue_date());
//                    quoteBean.setCurrent_year_percent(x.getQuote().getCurrent_year_percent());
//                    quoteBean.setHigh52w(x.getQuote().getHigh52w());
//                    quoteBean.setLow52w(x.getQuote().getLow52w());
//                    quoteBean.setLimit_up(x.getQuote().getLimit_up());
//                    quoteBean.setLimit_down(x.getQuote().getLimit_down());
//                    quoteBean.setVolume_ratio(x.getQuote().getVolume_ratio());
//                    quoteBean.setEps(x.getQuote().getEps());
//                    quoteBean.setPe_ttm(x.getQuote().getPe_ttm());
//                    quoteBean.setPe_forecast(x.getQuote().getPe_forecast());
//                    quoteBean.setPe_lyr(x.getQuote().getPe_lyr());
//                    quoteBean.setNavps(x.getQuote().getNavps());
//                    quoteBean.setPb(x.getQuote().getPb());
//                    quoteBean.setDividend(x.getQuote().getDividend());
//                    quoteBean.setDividend_yield(x.getQuote().getDividend_yield());
//                    quoteBean.setProfit(x.getQuote().getProfit());
//                    quoteBean.setProfit_four(x.getQuote().getProfit_four());
//                    quoteBean.setProfit_forecast(x.getQuote().getProfit_forecast());
//                    quoteBean.setPledge_ratio(x.getQuote().getPledge_ratio());
//                    quoteBean.setGoodwill_in_net_assets(x.getQuote().getGoodwill_in_net_assets());
//                    quoteBean.setTimestamp_ext(x.getQuote().getTimestamp_ext());
//                    quoteBean.setCurrent_ext(x.getQuote().getCurrent_ext());
//                    quoteBean.setPercent_ext(x.getQuote().getPercent_ext());
//                    quoteBean.setChg_ext(x.getQuote().getChg_ext());
//                    return stockDetailInfo;
//                }
//        ).collect(Collectors.toList());
    }
}
